<?php
$this->breadcrumbs=array(
	t('Users Manager','fuser'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div class="contentwrapper"><!--Content wrapper-->
<div class="alert alert-info">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
<p><strong>
    <span class="icon16  brocco-icon-mic"></span>
<?php echo t('You may optionally enter a comparison operator at the beginning of each of your search values to specify how the comparison should be done.','search'); ?>
</strong></p>
</div>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button btn')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php
    $this->widget('bootstrap.widgets.TbExtendedGridView', array(
        'filter'=>$model,
        'type'=>'striped bordered',
        'dataProvider' => $model->search(),
        'template' => "{pager}\n{items}\n{extendedSummary}\n{pager}",
        'id'=>'user-grid',
        'responsiveTable'=>true,
        'columns' => array(
            array(
                'name'=>'id',
                'headerHtmlOptions'=>array('width'=>'30px')
            ),
            'username',
            'display_name',
            //'former_display_name',
            //'password',
            'email',
            array(
                'name'=>'status',
                'value'=>array($model,'rederStatus'),
            ),
            //'time_ban',
            array(
                'name'=>'recent_login',
                'value'=>'$data->recent_login?date("d-m-Y H:i:s", $data->recent_login):"N/a"',
            ),
            array(
                'name'=>'recent_ip',
                'value'=>'$data->recent_ip?$data->recent_ip:"N/a"',
            ),

            /*
             array(
                'name'=>'created_time',
                'value'=>'date("d-m-Y H:i:s", $data->created_time)',
            ),
            'updated_time',
            'user_activation_key',
            'confirmed',
            'gender',
            'location',
            'birthday_month',
            'birthday_day',
            'birthday_year',
            'avatar',
            'email_site_news',
            'email_search_alert',
            'email_recover_key',
            */
            array(
                'class'=>'bootstrap.widgets.TbButtonColumn',
            )),
        'extendedSummary' => array(
            'title' => t('Total Users'),
            'columns' => array(
                'status' => array(
                    'label'=>t('Status'),
                    'types' => array(
                        t('Active')=>array('label'=>t('Active')),
                        t('Banned')=>array('label'=>t('Banned')),
                        t('Deactivate')=>array('label'=>t('Deactivate'))
                    ),
                    'class'=>'TbPercentOfTypeEasyPieOperation',
                    // you can also configure how the chart looks like
                    'chartOptions' => array(
                        'barColor' => '#333',
                        'trackColor' => '#999',
                        'lineWidth' => 8 ,
                        'lineCap' => 'square'
                    )
                )
            )
        ),
        'extendedSummaryOptions' => array(
            'class' => 'well pull-right',
            'style' => 'width:350px'
        ),
    ))
?>
